/**
 * @file usr_ec11.h
 * @author 黑马小乌龟 (532352406@qq.com)
 * @brief 
 * @version 0.1
 * @date 2025-08-19
 * 
 * @copyright Copyright (c) 2025
 * 
 */
#ifndef USR_EC11__H_H
#define USR_EC11__H_H

#ifdef __cplusplus
extern "C"{
#endif
#include<stdint.h>
#include<stdio.h>

#include "ev_hc32f334_lqfp64_bsp.h"
#include "hc32_ll.h"


typedef enum{
    EC11_EVENT_NULL=0,
    EC11_ROTATE_CW,/*顺时针旋转*/
    EC11_ROTATE_CCW,/*逆时针旋转*/
}EC11_EVENT_T;

#define ROTATE_TRIG_TIMEOUT 150u /*mS*/
#define ROTATE_TIMEOUT_L1 (ROTATE_TRIG_TIMEOUT-50)
#define ROTATE_TIMEOUT_L2 (ROTATE_TRIG_TIMEOUT-90)
#define ROTATE_TIMEOUT_L3 (ROTATE_TRIG_TIMEOUT-110)

#define EC11_DEBOUNCE_TIME 300u /*mS*/

extern EC11_EVENT_T ec11_event;

void ec11_rec_io_init(void);
void usr_ec11_debounce_handle(void);
EC11_EVENT_T get_ec11_roate_state(void);
#ifdef __cplusplus
}
#endif

#endif //USR_EC11__H_H


